package com.landiao.common.pojo;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Querier implements Serializable {

	private static final long serialVersionUID = 2724000707063229552L;

	private boolean _search;
	private Integer page = 1;
	private Integer rows = 10;
	private Integer index;
	private String sidx;
	private String sord;
	private Map<String, Object> params = new HashMap<String, Object>();

	public boolean is_search() {
		return _search;
	}

	public void set_search(boolean _search) {
		this._search = _search;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}

	public String getSidx() {
		return sidx;
	}

	public void setSidx(String sidx) {
		this.sidx = sidx;
	}

	public String getSord() {
		return sord;
	}

	public void setSord(String sord) {
		this.sord = sord;
	}

	public Map<String, Object> getParams() {
		return params;
	}

	public void setParams(Map<String, Object> params) {
		this.params = params;
	}

	public Integer getIndex() {
		this.index = (page - 1) * rows < 0 ? 0 : (page - 1) * rows;
		return index;
	}

	public void setIndex(Integer index) {
		this.index = index;
	}

	public Querier addParam(String key, Object value) {
		this.params.put(key, value);
		return this;
	}

	public Object getParam(String key) {
		return this.params.get(key);
	}
	
	public Object get(String key) {
		return this.params.get(key);
	}

	public void set(String key, Object value) {
		this.params.put(key, value);
	}
}
